import { ref } from 'vue';
import { defineStore } from 'pinia';

const useCounterStore = defineStore('counter', () => {
	const count = ref(0)
	const increment = () => {
		count.value++
	}
	
	return { 
		count,
		increment
	}
}, {
	persist: {
		key: 'my-custom-key',
		storage: {
			getItem(key) {
				return uni.getStorageSync(key)
			},
			setItem(key, value) {
				uni.setStorageSync(key, value)
			}
		}
	}
})

export default useCounterStore